:root {
  --hwt-bg-color: #fcfcfc;
  --hwt-text-color: black;
  --hwt-active-color: dodgerblue;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hwt-bg-color: #303030;
    --hwt-text-color: #f2f2f2;
    --hwt-active-color: #84c2ff;
  }
}
[data-user-color-scheme=dark] {
  --hwt-bg-color: #303030;
  --hwt-text-color: #f2f2f2;
  --hwt-active-color: #84c2ff;
}

#widget-tree-button {
  position: fixed;
  z-index: 1001;
  top: 46%;
  left: 0rem;
  display: flex;
  background-color: var(--hwt-bg-color);
  width: 1.5rem;
  height: 3rem;
  justify-content: flex-start;
  align-items: center;
  border-top-right-radius: 1.5rem;
  border-bottom-right-radius: 1.5rem;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}
#widget-tree-button:hover {
  opacity: 1;
  color: var(--hwt-active-color);
}
#widget-tree-button i {
  margin-left: -2px;
}
#widget-tree-button.open {
  left: 20rem;
}

.gg-folder-add {
  background: linear-gradient(to left, currentColor 10px, transparent 0) no-repeat center center/2px 6px;
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 22px;
  height: 16px;
  border: 2px solid;
  border-radius: 3px;
}

.gg-folder-add::after,
.gg-folder-add::before {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
}

.gg-folder-add::before {
  background: currentColor;
  left: 6px;
  width: 6px;
  height: 2px;
  top: 5px;
}

.gg-folder-add::after {
  width: 10px;
  height: 4px;
  border: 2px solid;
  border-bottom: 0;
  border-top-left-radius: 2px;
  border-top-right-radius: 4px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  top: -5px;
}

.gg-folder-remove {
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 22px;
  height: 16px;
  border: 2px solid;
  border-radius: 3px;
}

.gg-folder-remove::after,
.gg-folder-remove::before {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
  border-radius: 3px;
}

.gg-folder-remove::before {
  background: currentColor;
  left: 5px;
  width: 8px;
  height: 2px;
  top: 5px;
}

.gg-folder-remove::after {
  width: 10px;
  height: 4px;
  border: 2px solid;
  border-bottom: 0;
  border-top-left-radius: 2px;
  border-top-right-radius: 4px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  top: -5px;
}

.gg-file-document {
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 14px;
  height: 16px;
  border: 2px solid transparent;
  border-right: 0;
  border-top: 0;
  box-shadow: 0 0 0 2px;
  border-radius: 1px;
  border-top-right-radius: 4px;
  overflow: hidden;
}

.gg-file-document::after,
.gg-file-document::before {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
}

.gg-file-document::before {
  background: currentColor;
  box-shadow: 0 4px 0, -6px -4px 0;
  left: 0;
  width: 10px;
  height: 2px;
  top: 8px;
}

.gg-file-document::after {
  width: 6px;
  height: 6px;
  border-left: 2px solid;
  border-bottom: 2px solid;
  right: -1px;
  top: -1px;
}

.gg-chevron-right {
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 100px;
}

.gg-chevron-right::after {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid;
  border-right: 2px solid;
  transform: rotate(-45deg);
  right: 6px;
  top: 4px;
}

.gg-chevron-left {
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 100px;
}

.gg-chevron-left::after {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid;
  border-left: 2px solid;
  transform: rotate(45deg);
  left: 6px;
  top: 4px;
}

.gg-file-add {
  background: linear-gradient(to bottom, currentColor 5px, transparent 0) no-repeat 2px 9px/6px 2px;
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 14px;
  height: 16px;
  border: 2px solid transparent;
  border-right: 0;
  border-top: 0;
  box-shadow: 0 0 0 2px;
  border-radius: 1px;
  border-top-right-radius: 4px;
  overflow: hidden;
}

.gg-file-add::after,
.gg-file-add::before {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
  height: 6px;
}

.gg-file-add::before {
  background: currentColor;
  left: 4px;
  width: 2px;
  top: 7px;
}

.gg-file-add::after {
  width: 6px;
  border-left: 2px solid;
  border-bottom: 2px solid;
  right: -1px;
  top: -1px;
}

.gg-file-remove {
  box-sizing: border-box;
  position: relative;
  display: block;
  transform: scale(var(--ggs, 1));
  width: 14px;
  height: 16px;
  border: 2px solid transparent;
  border-right: 0;
  border-top: 0;
  box-shadow: 0 0 0 2px;
  border-radius: 1px;
  border-top-right-radius: 4px;
  overflow: hidden;
}

.gg-file-remove::after,
.gg-file-remove::before {
  content: "";
  display: block;
  box-sizing: border-box;
  position: absolute;
  width: 6px;
}

.gg-file-remove::before {
  background: currentColor;
  left: 2px;
  height: 2px;
  top: 9px;
}

.gg-file-remove::after {
  height: 6px;
  border-left: 2px solid;
  border-bottom: 2px solid;
  right: -1px;
  top: -1px;
}

#widget-tree {
  position: fixed;
  z-index: 1000;
  top: 0px;
  left: -20rem;
  bottom: 0px;
  box-sizing: border-box;
  width: 20rem;
  padding: 1rem 0.5rem;
  background-color: var(--hwt-bg-color);
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  overflow: auto;
  transition: all 0.2s;
}
#widget-tree.open {
  left: 0rem;
}
#widget-tree ul {
  list-style-type: none;
  margin: 0;
  padding: 0 1rem;
}
#widget-tree a {
  color: var(--hwt-text-color);
  cursor: pointer;
}
#widget-tree a:hover {
  color: var(--hwt-active-color);
}

.toggle-post-icon,
.toggle-toc-icon {
  color: var(--hwt-text-color);
  display: inline-block;
  vertical-align: -3px;
  margin-right: 5px;
  --ggs: 0.75;
}
.toggle-post-icon:hover,
.toggle-toc-icon:hover {
  color: dodgerblue;
  cursor: pointer;
}

.post-icon {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 4px;
  --ggs: 0.75;
}

.tree-list-post-link {
  font-size: 0.9rem;
}

.tree-list-item .tree-list-children,
.tree-list-children .tree-list-children {
  display: none;
}
.tree-list-item.open > .toggle-post-icon,
.tree-list-children.open > .toggle-post-icon {
  color: var(--hwt-active-color);
}
.tree-list-item.open > .tree-list-children,
.tree-list-children.open > .tree-list-children {
  display: block;
}

.tree-post-toc {
  display: none;
}

.tree-list-item.open > .toggle-toc-icon {
  color: var(--hwt-active-color);
}
.tree-list-item.open > .tree-post-toc {
  display: block;
}

.tree-post-toc,
.tree-post-toc-child {
  list-style-type: none;
  padding-left: 0.9rem;
  font-size: 0.85rem;
}
